from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
admin.autodiscover()

import EE.views.main
import EE.views.game
import EE.views.round
import EE.views.news
import EE.views.contract
import EE.views.user
import EE.views.login

UUID = r"(?P<uuid>[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})"
USER_ID = r"(?P<user_id>[0-9]+)"
ID_STR = r"(?P<id_str>%s)" % UUID
LOL = r"(?P<img_name>[0-9a-zA-Z-./_()]+)"
IMG_TYPE = r"(?P<img_type>original|bitmap|overlay)"
TYPE = r"(?P<type>released|volatile)"
IMG_SIZE = r"(?P<img_size>[0-9]+)"
IMG_RATIO = r"(?P<img_ratio>(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?)))"
IMG_WIDTH = r"(?P<img_width>(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?)))"
IMG_HEIGHT = r"(?P<img_height>(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?)))"

urlpatterns = patterns('',
    (r'^$', EE.views.main.Home()),
    (r'^admin/(.*)', admin.site.root),
	(r'^game/new$', EE.views.game.NewGame()),
	(r'^game/home$', EE.views.game.Home()),
	(r'^game/editGame/%s$' % ID_STR, EE.views.game.EditGame()),
	(r'^game/(.*)', EE.views.game.Home()),
	(r'^round/new/%s$' % ID_STR, EE.views.round.New()),
	(r'^round/home/%s$' % ID_STR, EE.views.round.Home()),
	(r'^round/edit/%s$' % ID_STR, EE.views.round.New()),
	(r'^round/endRound/%s$' % ID_STR, EE.views.round.End()),
	(r'^round/(.*)', EE.views.round.Home()),
	(r'^news/home/%s$' % ID_STR, EE.views.news.Home()),
	(r'^news/(.*)', EE.views.main.Home()),
	(r'^contract/bid/%s/%s$' % (TYPE, ID_STR), EE.views.contract.Bid()),
	(r'^contract/(.*)', EE.views.main.Home()),
    (r'^login', EE.views.login.Login()),
    (r'^logout', EE.views.login.Logout()),
    #(r'^imageLoader/byRatio/%s/%s/%s$' % (IMG_TYPE, IMG_RATIO, UUID), casam.views.imageloader.RatioHandler()),
    #(r'^imageLoader/byWidth/%s/%s/%s$' % (IMG_TYPE, IMG_WIDTH, UUID), casam.views.imageloader.WidthHandler()),
    #(r'^imageLoader/byMaxWidthHeight/%s/%s/%s/%s$' % (IMG_TYPE, IMG_WIDTH, IMG_HEIGHT, UUID), casam.views.imageloader.MaxWidthHeightHandler()),
    #(r'^imageLoader/byMinWidthHeight/%s/%s/%s/%s$' % (IMG_TYPE, IMG_WIDTH, IMG_HEIGHT, UUID), casam.views.imageloader.MinWidthHeightHandler()),
    #(r'^imageLoader/thumbnail/%s/%s/%s$' % (IMG_TYPE, IMG_SIZE, UUID), casam.views.imageloader.ThumbnailHandler()),
    #(r'^imageLoader/%s/%s$' % (IMG_TYPE, UUID), casam.views.imageloader.SimpleHandler()),
    (r'^user/home$', EE.views.user.Home()),
    (r'^user/newUser$', EE.views.user.CreateUser()),
	
	#resultaten -->> results/home -->> EE.views.result.Home() -->> Laatste gamestate + verhaaltje + kapotte windmolens [N(0.5,0.4) > 0.75] (specifiek voor de groep) + opbrengst vd windmolens (afhankelijk van windsnelheid [N(4,4)] afgelopen maand + aantal windmolend van bepaald type * opbrengst van dat type)
	#nieuws -->> news/home -->> EE.views.news.Home() -->> nieuwe contracten (informatie voor iedereen binnen een game)
	#overzicht -->> huidige gamestate + geschiedenis (alle gamestates van een user+game dus) --->>> Ben
	#beslissingen -->> round/home -->> EE.views.round.Home() -->> Huidige StaVaZa (huidige gamestate + huidige beslissingen) --->>> Ben
    
)

if settings.DEBUG:
  urlpatterns += patterns('',
      (r'^media/(.*)$', 'django.views.static.serve', {'document_root': 'media'}),
  )
